"use client";
import { FormEventHandler, useState } from "react";
import {
    useRouter,
    usePathname,
    useSearchParams,
    useParams,
} from "next/navigation";
export default function NavigationPage() {
    const router = useRouter();
    const pathname = usePathname();
    const searchParams = useSearchParams();
    const params = useParams();
    console.log("params", params);
    const [v, setV] = useState(pathname);
    const onInput: FormEventHandler<HTMLInputElement> = (e) =>
        setV(e.currentTarget.value);
    return (
        <div>
            <p>pathname: {pathname}</p>
            <p>searchParams: {searchParams.toString()}</p>
            <p>params: {JSON.stringify(params)}</p>
            <div>
                <input type="text" value={v} onInput={onInput}></input>
                <br />
                <button onClick={() => router.push(v)}>转去{v}</button>
            </div>
        </div>
    );
}
